<?php
header("Content-Type: text/html; charset=utf-8");
require('../Smarty/libs/Smarty.class.php');
require_once('conn.inc');
date_default_timezone_set("PRC");

session_start();

if (!isset($_SESSION['username'])) {
	header ('location: login.php');
}

$mysql = new Mysql();

$result = array();
$strsql = "SELECT * FROM "."bg";
$result = $mysql->select($strsql);

for ($i=0;$i <count($result);$i++) {
	$bg_people_id = ($result[$i]["bg_people_id"]);
	$sql = sprintf ("SELECT * FROM %s WHERE id = %d","people",$bg_people_id);
	$bg_people = $mysql->select($sql);
	if ((!$bg_people) or count ($bg_people) == 0) 
		echo "不能查询到报告人信息";
	$result[$i]["bg_people_name"] = $bg_people[0]["name"];
}

$dbcolarray = array('id', '报告人','标题','开始时间','状态','备注');
$tpl = new Smarty;

$tpl->assign('username',$_SESSION['username']);
$tpl->assign('db_count', count($result));
$tpl->assign('db_coltitle', $dbcolarray);
$tpl->assign('db_rows', $result);
$tpl->display('show.html');
?>